define(['app'], function(app) {
	'use strict';

	var controller = function controller($scope, Orderlogistics,$stateParams,GoDialog,GoPage) {
		
		$scope.$on('$ionicView.afterEnter', function() {
			$scope.order_id = $stateParams.order_id;
			$scope.init_data();
		}, false);
		
		$scope.init_data = function(){
			Orderlogistics.order_logistics($scope.order_id,function(data){
				console.log(data)
				if(!data.success){
					GoDialog.alert("提示",data.msg,function(){
						GoPage.go_back();
					})
					return;
				}
				if(data.result.error){
					GoDialog.alert("提示",data.result.error,function(){
						GoPage.go_back();
					})
					return;
				}
				$scope.datas = data.result;
			});
		}


	}

	controller.$inject = ['$scope', 'Orderlogistics','$stateParams','GoDialog','GoPage'];
	
	return app.registerController("orderlogisticsctrl",controller);
});